package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gwk
 * @create 2021 -09 -05 13:11
 */
@RestController
@RequestMapping("/goodsType")
public class GoodsTypeController {
    /**
     * 查询所有分类
     */
    @Autowired
    GoodsTypeService goodsTypeService;

    @PostMapping("/loadGoodsType")
    public String loadGoodsType(){
        return goodsTypeService.loadGoodsType();
    }

    /**
     * 新增分类
     */
    @PostMapping("/save")
    public ServiceVO save(String goodsTypeName,Integer pId){
        return goodsTypeService.save(goodsTypeName,pId);
    }
    /**
     * 删除分类
     */
    @PostMapping("/delete")

    public ServiceVO delete(Integer  goodsTypeId){
        return goodsTypeService.delete(goodsTypeId);
    }
}
